<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //charAt根据索引获取指定位置字符  
        //找不到返回空字符串，而str[1000]找不到返回undefined
        //charCodeAt获取指定字符的Ascll码值    
        let str = "shidazhi"
        for (let i = 0; i < str.length; i++) {
            console.log(str.charAt(i));
            console.log(str.charCodeAt(i));

        }


        //通过ascll码值找到字符
        String.fromCharCode(122)
    </script>
</body>

</html>